package com.example.richman;

import java.util.ArrayList;
import java.util.Random;

import android.annotation.SuppressLint;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.RelativeLayout.LayoutParams;

public class QuestionPane extends ChargingPane {

	String[] question1 = new String[] { "选出一个非面向对象的语言", "C语言", "C++", "JAVA",
			"C#", "1",

	};
	String[] question2 = new String[] { "CCP的全称是什么", "中国共产党中央委员会", "中国共产党",
			"中共共产党政治委员会", "我他妈的不知道啊", "2",

	};
	String[] question3 = new String[] { "MOV AX,[bx]di，实际上访问内存的地址的值是多少",
			"ds+bx+di", "ds*16+bx+di", "bx+di", "bx*16+di", "2",

	};
	String[] question4 = new String[] { "将匈奴击退到漠北在位的皇帝是哪个", "钩弋夫人", "刘邦",
			"刘弗陵", "刘彻", "4",

	};
	String[] question5 = new String[] {
			"根据热化学方程式：S(s)+O2(g)=SO2(g)；△H=－297.23kJ/mol。分析下列说法正确的是",
			"S(g)+O2(g)=SO2(g)；△H=－Q。Q的值不小于297.23",
			"S(g)+O2(g)=SO2(g)；△H=－Q。Q的值不大于297.23",
			"1molSO2的总能量小于1molS和1molO2能量总和", "1molSO2的总能量大于1molS和1molO2能量总和",
			"3",

	};

	ArrayList<String[]> questionCollection = new ArrayList<String[]>();

	QuestionPane(gameFuntionControl gameControl) {
		super(gameControl);
		// TODO Auto-generated constructor stub

		questionCollection = new ArrayList<String[]>();
		questionCollection.add(

		new String[] { "选出一个非面向对象的语言", "C语言", "C++", "JAVA", "C#", "1",

		});

		questionCollection.add(new String[] { "CCP的全称是什么", "中国共产党中央委员会",
				"中国共产党", "中共共产党政治委员会", "我他妈的不知道啊", "2",

		});

		questionCollection.add(new String[] { "MOV AX,[bx]di，实际上访问内存的地址的值是多少",
				"ds+bx+di", "ds*16+bx+di", "bx+di", "bx*16+di", "2",

		});

		questionCollection.add(new String[] { "将匈奴击退到漠北在位的皇帝是哪个", "钩弋夫人", "刘邦",
				"刘弗陵", "刘彻", "4",

		});
		questionCollection.add(new String[] {
				"根据热化学方程式：S(s)+O2(g)=SO2(g)；△H=－297.23kJ/mol。分析下列说法正确的是",
				"S(g)+O2(g)=SO2(g)；△H=－Q。Q的值不小于297.23",
				"S(g)+O2(g)=SO2(g)；△H=－Q。Q的值不大于297.23",
				"1molSO2的总能量小于1molS和1molO2能量总和",
				"1molSO2的总能量大于1molS和1molO2能量总和", "3",

		});

		questionCollection.add(new String[] { "最终幻想VIII中登场的女主角为：", "蒂法", "莉诺雅",
				"尤雅", "雷霆", "2", });

		questionCollection.add(new String[] { "USB3.0 的插口通常为何种颜色？", "紫", "蓝",
				"橙", "黑", "2", });

		questionCollection.add(new String[] { "以下哪部动画不是京阿尼的作品？", "轻音少女", "冰菓",
				"我女友与青梅竹马的惨烈修罗场", "玉子市场", "3", });

		questionCollection.add(new String[] { "IBM5100的CPU型号？", "P-II", "P-0",
				"P-I", "P-III", "4", });

		questionCollection.add(new String[] { "化学中，苦味酸是___", "超盐酸", "三硝基苯酚",
				"三硝基乙苯", "过二硫酸", "2", });

		questionCollection.add(new String[] { "杀手47的后脑勺上有什么", "条形码", "发髻",
				"当然是头发", "龙纹", "1", });

		questionCollection.add(new String[] { "身为纯爷们，绝对从不回头看什么？", "凡人", "战友",
				"女神", "爆炸", "4", });

		questionCollection.add(new String[] { "魔兽世界里的联盟英雄吉安娜是什么职业？", "武僧",
				"盗贼", "死亡骑士", "法师", "4", });

		questionCollection.add(new String[] { "薛定谔的猫是薛定谔的一个著名实验，其不涉及的问题是？",
				"观测者对实验的影响", "势垒穿透", "量子的不确定性", "量子的叠加态", "2", });

		questionCollection.add(new String[] { "阿姆斯特朗回旋加速喷气式阿姆斯特朗炮的名字出自哪部动漫？",
				"银魂", "旋风管家", "名侦探柯南", "北斗神拳", "1", });

		questionCollection.add(new String[] { "国产动画片《魁拔》中，魁拔的重生时间是？", "666年",
				"444年", "555年", "333年", "4", });

		questionCollection.add(new String[] { "国际标准化组织ISO制定的OSI模型中，路由器工作在哪一层？",
				"传输层", "网络层", "应用层", "数据链路层", "2", });

		questionCollection.add(new String[] { "由Nintendo公司发售的8位游戏机的名称缩写是什么？",
				"FC", "XBOX", "PS3", "PSP", "1", });

		questionCollection.add(new String[] { "正面上我啊是哪个人物的名台词?", "高町奈叶", "宫永咲",
				" 御坂美琴", "秋月爱莉", "3", });

		questionCollection.add(new String[] { "日本动画片《蜡笔小新》中，小新最喜欢的超人是", "钢铁超人",
				"铅笔超人", "蜡笔超人", "动感超人", "4", });
		questionCollection.add(new String[] { "下列各项不属于电脑操作系统的是", "S60", "XP",
				"DOS", "UNIX", "1", });
		questionCollection.add(new String[] { "《穿越火线》由国内哪家公司代理运营？", "网易", "完美",
				"腾讯", "九城", "3",

		});

		questionCollection.add(new String[] { "是谁提出“感应电流的磁场总是要阻碍引起感应电流的磁通量的变化",
				"牛顿", "法拉第", "楞次", "安培", "3", });
	
	
	questionCollection.add(new String[]{"傅里叶级数是傅里叶在研究哪种物理现象时提出的？",
			"量子力学","电磁波","机械振动","热传导","4",
			});
	
	questionCollection.add(new String[]
			{"路过草从最担心的是哪句话？",
			"妈妈卡","德玛西亚","刷特","一库油","2",
			});
	
	questionCollection.add(new String[]
			{"魔兽世界里的联盟英雄吉安娜是什么职业",
			"武僧","盗贼","死亡骑士","法师","4",

			});
	
	questionCollection.add(new String[]
			{"1919年,《新青年》杂志发表《我的马克思主义观》一文,。这篇文章的作者是",
			"陈独秀","李大钊","李达","阿毛","2",

			});
	
	

	questionCollection.add(new String[]
			{"NBA正式赛季于每年11月开始，分为常规赛和季后赛两部分。常规赛为循环赛制，每支球队都要完成多少场比赛？","62场","72场","82场","92场","3",
			});
	
	questionCollection.add(new String[]{"著名导演李安凭借下列哪部电影获得奥斯卡最佳导演奖?","《色戒》","《断背山》","《卧虎藏龙》","《喜宴》","2",});
	
	questionCollection.add(new String[]{"哪个国家的足球队号称战车","法国","西班牙","德国","中国","3"});

	questionCollection.add(new String[]{"里皮曾经是哪个国家的足球教练","意大利","葡萄牙","韩国","英格兰","1"});

	questionCollection.add(new String[]{"akb总选举第一名是谁","大岛优子","前田敦子","大岛敦子","指原莉乃","2"});

	questionCollection.add(new String[]{"akb中被称为正统偶像和CG的人是","小野惠玲奈","松井珠理奈","渡边麻友","小乔","3",});


	}
	
	@SuppressLint("NewApi")
	public void presentTipsPanelQinshihuang(final Spriters spriters) {
		Random random = new Random();

		

		final String[] QA = questionCollection.get(random
				.nextInt(questionCollection.size()));

		linerlayout = new LinearLayout(spriters.context);
		tempLy = new RelativeLayout.LayoutParams(
				ViewGroup.LayoutParams.WRAP_CONTENT,
				ViewGroup.LayoutParams.WRAP_CONTENT);
		tempLy.addRule(RelativeLayout.ALIGN_PARENT_LEFT, R.layout.gamemap);
		tempLy.addRule(RelativeLayout.ALIGN_TOP, R.layout.gamemap);
		tempLy.setMargins(500, 250, 1920, 1080);
		linerlayout.setLayoutParams(tempLy);

		linerlayout.setVisibility(View.VISIBLE);

		TextView test = new TextView(spriters.context);
		test.setText("请" + spriters.RoleName + "回答下列问题：" + QA[0]
				+ "回答正确奖励800，错误扣除500");

		test.setTextColor(Color.BLACK);
		test.setTextSize(15);

		final TextView test2 = new TextView(spriters.context);
		test2.setTextColor(Color.BLACK);
		test2.setTextSize(20);
		test2.setText("A:" + QA[1]);
		test2.setOnClickListener(new OnClickListener() {
     
			@Override
			public void onClick(View v) {
				if (QA[5] == "1") {

					gameControl.addMoney(800, spriters);
					linerlayout.setVisibility(View.GONE);
				}

				else {
					gameControl.addMoney(-500, spriters);
					linerlayout.setVisibility(View.GONE);
				}
			}

		});

		final TextView test3 = new TextView(spriters.context);
		test3.setTextSize(20);
		test3.setTextColor(Color.BLACK);
		test3.setText("B:" + QA[2]);
		test3.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				if (QA[5] == "2") {

					gameControl.addMoney(800, spriters);
					linerlayout.setVisibility(View.GONE);
				}

				else {
					gameControl.addMoney(-500, spriters);
					linerlayout.setVisibility(View.GONE);
				}
			}
		});

		final TextView test4 = new TextView(spriters.context);
		test4.setTextSize(20);
		test4.setTextColor(Color.BLACK);
		test4.setText("C:" + QA[3]);
		test4.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				if (QA[5] == "3") {

					gameControl.addMoney(800, spriters);
					linerlayout.setVisibility(View.GONE);
				}

				else {
					gameControl.addMoney(-500, spriters);
					linerlayout.setVisibility(View.GONE);
				}
			}
		});

		final TextView test5 = new TextView(spriters.context);
		test5.setTextSize(20);
		test5.setTextColor(Color.BLACK);
		test5.setText("D:" + QA[4]);
		test5.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				if (QA[5] == "4") {

					gameControl.addMoney(800, spriters);
					linerlayout.setVisibility(View.GONE);
				}

				else {
					gameControl.addMoney(-500, spriters);
					linerlayout.setVisibility(View.GONE);
				}
			}
		});

		LayoutParams params = (LayoutParams) linerlayout.getLayoutParams();
		params.height = (int) (600);
		params.width = (int) (1000);

		linerlayout.setLayoutParams(params);
		linerlayout.setOrientation(1);

		linerlayout.addView(test);
		linerlayout.addView(test2);
		linerlayout.addView(test3);
		linerlayout.addView(test4);
		linerlayout.addView(test5);
		
		linerlayout.setBackground(spriters.getResources().getDrawable(
				R.drawable.pannelbackground));
		
		Drawable drawable = linerlayout.getBackground();
		drawable.setAlpha(150);
	
		spriters.AdjoinLayout.addView(linerlayout);

	}

}
